var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var _ = require('lodash');
var roleService = require('../../app/services/roleService');
var config = require('../config');
var dataApi = require('../../app/libs/dataApi');
var roleModel = require('../../app/models/roleModel');
var buildModel = require('../../app/models/buildModel');
var PlayerManager = require('../../app/libs/playerManager');
var configUtil = require('../../app/util/configUtil');
var analyze = require('kc-analyze');

suite('初始化', function () {
    test('analyze', function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id,
            verify_key: analyze_config.verify_key
        });
        done();
    });
});

suite('测试roleService', function () {
    var player_manager = new PlayerManager(config.role_id);
    setup(function (done) {
        player_manager.getModel(['role', 'build', 'bag', 'skill', 'task', 'FoodCarbon', 'GoldCarbon', 'daily_task', 'achieve', 'tech', 'accrued'], function (err, model) {
            done();
        });
    });
    var module_type = 100;
    var operation_type = 200;

    suite('vipChanged', function () {
        test('VIP等级变化', function () {
            roleService.vipChanged(player_manager, 1, 2);
        });
    });

    //suite('addGold', function () {
    //test('添加金币', function () {
    //roleService.addGold(player_manager, module_type, operation_type, 100);
    //});

    //test('添加金币', function () {
    //player_manager.role.addGold(100);
    //roleService.addGoldLimit(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('addFood', function () {
    //test('添加粮食', function () {
    //roleService.addFood(player_manager, module_type, operation_type, 100);
    //});

    //test('添加粮食', function () {
    //player_manager.role.addFood(100);
    //roleService.addFoodLimit(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('subDiamond', function () {
    //test('扣除钻石', function () {
    //roleService.subDiamond(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('addDiamond', function () {
    //test('增加加钻石', function () {
    //roleService.addDiamond(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('addExp', function () {
    //test('添加经验', function () {
    //roleService.addExp(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('addProtectTime', function () {
    //test('添加保护时间', function () {
    //roleService.addProtectTime(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('addDragonGold', function () {
    //test('添加龙币', function () {
    //roleService.addDragonGold(player_manager, module_type, operation_type, 100);
    //});
    //});

    //suite('subDragonGold', function () {
    //test('扣除龙币', function () {
    //roleService.subDragonGold(player_manager, module_type, operation_type, 100);
    //});
    //});
    player_manager.save();

    // suite('syncRoleLevel', function () {
    //     test('同步角色等级', function (done) {
    //         this.timeout(10000);
    //         roleService.syncRoleLevel(done);
    //     });
    // });
});
